/**
 * 
 */
package com.dhcc.cdbp.solrj;

import java.io.IOException;

import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocumentList;

/**
 * @author 谢进军
 *
 */
public class TestSolrQuery1 {
	private static final String urlString = "http://localhost:8080/solr/core_c";
	public static void main(String[] args) throws SolrServerException, IOException {
		SolrClient solr = new HttpSolrClient(urlString);
		System.out.println("yy");
		SolrQuery query = new SolrQuery();
		query.setQuery("*:*");
		// query.addSort("id", SolrQuery.ORDER.asc);
		QueryResponse response = solr.query(query);
		SolrDocumentList results = response.getResults();

		for (int i = 0; i < results.size(); i++) {
			System.out.println(results.get(i));
		}
	}
}
